/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lyricsguy.lyrics.container;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author User
 */
public class LyricsContainerAnalyzer {

    private Map<String, Integer> wordsCounter = new HashMap();

    public void createWordsMap() {
        List<String> words = LyricsContainer.instance().getWords();
        for (String word : words) {
            if (wordsCounter.keySet().contains(word)) {
                int repeats = wordsCounter.get(word);
                repeats += 1;
                wordsCounter.put(word, Integer.valueOf(repeats));
                //System.out.println("Word counter increased: '" + word + "'");
            } else {
                wordsCounter.put(word, Integer.valueOf(1));
                //System.out.println("Word added: '" + word + "'");
            }
        }

    }

    public Map<String, Integer> getWordsMap() {
        return wordsCounter;
    }
}
